<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;

class TextCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'command:user';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        $user = DB::connection('userCenter')->table('user');
        $arr = range('A', 'Z');
        $arr = array_merge($arr, range('a', 'z'));
        $arr = array_merge($arr, range(0, 9));
        for ($i=0; $i<100000; $i++) {

//            $res[$i] = [
//                'role_id' => rand(1, 5),
//                'member_name' => implode('', array_slice($arr, 0, 6)) . $i,
//                'member_password' => md5('123456'),
//                'member_uuid' => uniqid('uuid'),
//                'member_token' => '',
//                'member_phone' => mt_rand(13000000000,19000000000),
//            ];
//            $res[$i]['member_email'] = $res[$i]['member_name'].'@xin.com';
//            dd(1);
            echo ' '.$i;
            $insert['role_id'] = rand(1, 5);
            shuffle($arr);
            $name = array_slice($arr, 0, 6);
            $insert['member_name'] = implode('', $name) . $i;
            $insert['member_password'] = md5('123456');
            $insert['member_uuid'] = uniqid('uuid');
            $insert['member_token'] = '';
            $insert['member_email'] = $insert['member_name'].'@xin.com';
            $insert['member_phone'] = mt_rand(13000000000,19000000000);
            $user->insert($insert);
        }
        echo '================end=================';
    }

}
